﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AMS.LCM.Models;

namespace AMS.LCM.Controllers
{
    public class LCMController
    {
        LCMForm _form;
        LCMModel _model;

        public event EventHandler<LCMEventArgs> LCMCalculated
        {
            add { _model.LCMCalculated += value; }
            remove { _model.LCMCalculated -= value; }
        }

        public LCMController()
        {
            this._model = new LCMModel();
            this._form = new LCMForm(this);
            _form.Result = String.Empty;
        }

        public void Execute()
        {
            _form.ShowDialog();
        }

        public void CalculateLCM()
        {
            _model.CalculateLCM(int.Parse(_form.Integer));
        }
    }
}
